package tenth;
//泛型的嵌套 用一个类作为另一个类的泛型类型
class Info<T,V>{
    private T var;
    private V value;

    public Info(T var, V value) {
        this.var = var;
        this.value = value;
    }

    public T getVar() {
        return var;
    }

    public void setVar(T var) {
        this.var = var;
    }

    public V getValue() {
        return value;
    }

    public void setValue(V value) {
        this.value = value;
    }
}
class Demo<S>{      //泛型的嵌套  把info作为Demo泛型的类型
    private S info;

    public Demo(S info) {
        this.info = info;
    }

    public S getInfo() {
        return info;
    }

    public void setInfo(S info) {
        this.info = info;
    }
}
public class 泛型的嵌套设置 {
    public static void main(String[] args) {
        Demo<Info<String,Integer>> d =null;
        Info<String,Integer> i = null;

        i = new Info<String,Integer>("李四",30);
        d =new Demo<Info<String,Integer>>(i);

        System.out.println(d.getInfo().getVar());
        System.out.println(d.getInfo().getValue());
    }
}
/*
D:\WorkSpaces\Java\jdk-21\bin\java.exe "-javaagent:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\lib\idea_rt.jar=61238:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath D:\WorkSpaces\JavaDevelopBase_start_329\out\production\JavaDevelopBase_start_329 tenth.泛型的嵌套设置
李四
30

Process finished with exit code 0

 */